<?php
namespace app\index\model;

class Blog extends \think\Model
{
    /**
     * 根据搜索条件获取角色列表信息
     * @return array
     */
    public function index()
    {
        //1.先按照id顺序 查询出4篇带有图片描述的文章
        $title_list = $this->field('id,title,summary,title_img')->where('title_img','NEQ','')->order('id DESC')->limit(4)->select();
        //dump($title_list[0]->data);
        $data['title_list'] = $title_list;

        //2.取下面大图文章 调用分页方法 paginate()
        $list = $this->field('id,title,summary,big_img,content')->order('id desc')->paginate(3);
        //dump($list);
        $data['list'] = $list;

        return $data;
    }
}